package online.inote.naruto.api.access.admin.modules.system.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;
import online.inote.naruto.api.access.admin.common.rule.GlobalRule;
import online.inote.naruto.api.access.admin.modules.base.entity.SignatureEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * @description 系统管理人实体对象
 * @author XQF.Sui
 * @date 2021/07/27 11:03
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@FieldNameConstants
@Table(name = "naruto_system_manager")
public class ManagerEntity extends SignatureEntity {

  private static final long serialVersionUID = -4184646532011307422L;

  @Id
  @Column(length = 36)
  protected String id;

  @Column(unique = true, nullable = false, length = 36)
  private String systemId;

  @NotBlank(message = "管理人姓名不能为空")
  @Column(nullable = false, length = 64)
  private String name;

  @NotBlank(message = "管理人电话不能为空")
  @Pattern(regexp = GlobalRule.Contact.MOBILE, message = "管理人电话必须为手机号码")
  @Column(nullable = false, length = 15)
  private String mobile;

  @NotBlank(message = "管理人邮箱")
  @Email(message = "管理人邮箱不是一个合法的地址")
  @Column(nullable = false, length = 64)
  private String email;
}
